<?php
$config = new RM_Config();
$currencySymbol = $config->getValue('rm_config_currency_symbol');

$priceConfigModel = new RM_UnitDailyPricesFixedConfig();

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr" id="RM_price_module_pricelist_page" >
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    </head>
    <body>
        <link rel="stylesheet" type="text/css" href="<?php echo RM_Environment::getConnector()->getRootURL(); ?>RM/userdata/css/user.css"/>
        <link rel="stylesheet" type="text/css" href="<?php echo RM_Environment::getConnector()->getRootURL(); ?>RM/userdata/css/user_overrides.css"/>
        <div class="RM_price_module_pricelist_container">
            <div class="RM_price_module_pricelist_header_container">
                <div class="RM_price_module_pricelist_header">
                    <?php echo $this->unit->name."&nbsp;".$this->_translate->_('User.Unit.Prices','Title');?>
                </div>
            </div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="RM_divTable">
              <tr class="RM_divHeaderRow">
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','PeriodName');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','StartDate');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','EndDate');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','MinStay');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','OneWeekendDay');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','FullWeekend');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','OneWeekDay');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','TwoWeekDays');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','ThreeWeekDays');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','FourWeekDays');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','FiveWeekDays');?>
                </td>
                <td class="RM_divHead">
                    <?php echo $this->_translate->_('User.Unit.List','FullWeek');?>
                </td>                  
              </tr>
              <?php
                $config = new RM_Config();
                $dateFormat = $config->getJSDateformat();
                $prices = $this->prices;
                $i=0;
                foreach ($prices as $price) {
                    if ($i % 2 != 0) {
                        // odd rows
                        $rowStyle = "RM_list_row_style1";
                    } else {
                        // even rows
                        $rowStyle = "RM_list_row_style2";
                    }
                    $i++; # Increment our row counter

                    // row loop
                    ?>
                    <tr>
                        <td class="<?php echo $rowStyle;?>">
                            <!-- period_name -->
                            <?php echo $price['period_name'];?>
                        </td>
                        <td class="<?php echo $rowStyle;?>">
                            <!-- start_datetime -->
                            <?php echo date($dateFormat, strtotime($price['start_datetime']));?>
                        </td>
                        <td class="<?php echo $rowStyle;?>">
                            <!-- end_datetime -->
                            <?php echo date($dateFormat, strtotime($price['end_datetime']));?>
                        </td>
                        <td class="<?php echo $rowStyle;?>">
                            <!-- min_stay -->
                            <?php
                            if ((int)$price['min_stay']>0) {
                                echo $price['min_stay'];
                            } else {
                                echo $this->_translate->_('User.Unit.List','NoRestriction');
                            }
                            ?>
                        </td>
                        <td class="<?php echo $rowStyle;?>">
                            <?php echo $currencySymbol.$price['one_weekend_day'];?>
                        </td>
                        <td class="<?php echo $rowStyle;?>">
                            <?php echo $currencySymbol.$price['full_weekend'];?>
                        </td>                        
                        <td class="<?php echo $rowStyle;?>">
                            <?php echo $currencySymbol.$price['one_week_day'];?>
                        </td>
                        <td class="<?php echo $rowStyle;?>">
                            <?php echo $currencySymbol.$price['two_week_days'];?>
                        </td>
                        <td class="<?php echo $rowStyle;?>">
                            <?php echo $currencySymbol.$price['three_week_days'];?>
                        </td>
                        <td class="<?php echo $rowStyle;?>">
                            <?php echo $currencySymbol.$price['four_week_days'];?>
                        </td>
                        <td class="<?php echo $rowStyle;?>">
                            <?php echo $currencySymbol.$price['five_week_days'];?>
                        </td>
                        <td class="<?php echo $rowStyle;?>">
                            <?php echo $currencySymbol.$price['full_week'];?>
                        </td>                        
                    </tr>
            <?php } // end row loop ?>
            </table>

        </div>
    </body>
</html>